﻿@model ADZ_LabelConfig

@{
    Layout = "~/Views/Shared/_ContentLayout.cshtml";
}
@{
    var viewModel = Model ?? new ADZ_LabelConfig();
    ADZ_MasterEntities dbcontext = new ADZ_MasterEntities();
    Dictionary<string, string> dc = new Dictionary<string, string>();
}
<form id="S_Form" action="@Url.Action("labelinfo", "product")" method="post" class="definewidth m20" enctype="multipart/form-data">
    <table class="table table-bordered table-hover definewidth m10">
        <tr>
            <td colspan="2" style="width:50%">
                <h5>
                    修改板块信息,此版块属于【@viewModel.base_label_name】
                </h5>
                <input type="hidden" value="@viewModel.label_type" name="label_type" />
            </td>
        </tr>
        <tr>
            <td class="tableleft">板块名称</td>
            <td>
                <input type="text" name="label_name" maxlength="50" value="@viewModel.label_name" />
            </td>
        </tr>
        <tr>
            <td class="tableleft">是否展示到前端</td>
            <td>
                <select id="is_show" name="is_show">
                    @{
                        dc.Add("0", "不展示");
                        dc.Add("1", "展示");
                    }
                    @HtmlPagerHelper.ShowSelectOpton(dc, viewModel.is_show.ToString())
                </select>
            </td>
        </tr>
        <tr>
            <td class="tableleft"></td>
            <td>
                <p><span id="spMsg"></span></p>
                <button type="submit" class="btn btn-primary">保存</button> &nbsp;&nbsp;
                <button type="button" class="btn btn-success" name="backid" id="backid">返回</button>
            </td>

        </tr>
    </table>
    <script>
        BUI.use('bui/overlay', function (overlay) {
            $(function () {
                var rules = {
                    'label_name': { required: true }
                };
                var messages = {
                    //'aDZ_GoodsMaster.goods_unit': { required: '售卖单位必选' },
                };

                var validator = $('form').validate({
                    errorLabelContainer: $("#errorContainer"),
                    errorElement: "span",
                    rules: rules,
                    messages: messages,
                    submitHandler: function (form) {
                        $(form).ajaxSubmit(function (result) {

                            ShowActionResult(result, function () { self.location = document.referrer; });//self.location = document.referrer;
                        });
                    }
                });

            });
        });

        $("input[name='views_Goods.goods_unit']").click(function () {
            $(".goods_unit").html($(this).val());
        });

    </script>
</form>
